package com.cloud.wms.ui.sort.car;

import android.content.Context;
import android.content.Intent;
import android.os.Message;
import android.view.View;

import com.cloud.core.utils.TimeUtils;
import com.cloud.wms.R;
import com.cloud.wms.base.BaseBarActivity;
import com.cloud.wms.config.IntentKey;
import com.cloud.wms.ui.main.entity.TaskEntity;
import com.cloud.wms.ui.sort.entity.BatchInfoEntity;

import butterknife.OnClick;

/**
 * @Author:Chen
 * @Date: 2021-01-22 17:50
 * @Description: 上架
 */
public class CarTypeActivity extends BaseBarActivity {
    private TaskEntity taskEntity;

    @Override
    protected String barTitle() {
        return "分拣方式";
    }

    @Override
    protected int getResId() {
        return R.layout.activity_sort_car_type;
    }

    @Override
    protected void setupComponent() {
    }

    @Override
    protected void initEvent() {
        taskEntity = (TaskEntity) getIntent().getParcelableExtra(IntentKey.TASK_KEY);
        if (taskEntity != null)
            taskEntity.setBeginTime(TimeUtils.getCurrentDateAndTime());
    }

    @Override
    public void onSuccess(Message message) {

    }

    @OnClick({R.id.tv_sort_batch, R.id.tv_sort_order})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_sort_batch://先拣后分 绑定一个容器
                CarBindActivity.start(this,
                        taskEntity,
                        false);
                this.finish();
                break;
            case R.id.tv_sort_order://边检边分  绑定多个容器
                CarBindDetachActivity.start(this,
                        taskEntity,
                        false);
                this.finish();
                break;
        }
    }

    public static void start(Context context, TaskEntity taskEntity) {
        Intent intent = new Intent(context, CarTypeActivity.class);
        intent.putExtra(IntentKey.TASK_KEY, taskEntity);
        context.startActivity(intent);
    }
}
